package lazy2.util;

import java.util.ArrayList;
import java.util.List;

public class BinaryChecker {
	class DataIndexStructure {
		byte[] data;
		int index = 0;
	}
	protected List<DataIndexStructure> checkDatas = new ArrayList<BinaryChecker.DataIndexStructure>();
	public void addCheckData(byte[] checkData) {
		if(checkData!=null) {
			DataIndexStructure d = new DataIndexStructure();
			d.data = checkData;
			checkDatas.add(d);
		}
	}
	public boolean isChecked(byte b) {
		for(DataIndexStructure checkData:checkDatas) {
			if(checkData.data[checkData.index]==b) {
				++checkData.index;
				if(checkData.index==checkData.data.length) {
					checkData.index = 0;
					return true;
				}
			} else {
				checkData.index = 0;
			}
		}
		return false;
	}
	public void reset() {
		for(DataIndexStructure checkData:checkDatas) {
			checkData.index = 0;
		}
	}
}
